<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML>
<!--
	Snapshot by 宝玉
-->
<html lang="zh-cn">
	<head>
		<title>SWAB-MAN 官网</title>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1" />
		<link rel="stylesheet" href="<c:url value="/templated/swab-man/assets/css/main.css"/>" />
		<link rel="stylesheet" href="<c:url value="/resources/hplus/lib/css/plugins/toastr/toastr.min.css"/>" />
	</head>
	<body>
		<div class="page-wrap">

			<!-- Nav -->
				<%--<nav id="nav">--%>
					<%--<ul>--%>
						<%--<li><a href="<c:url value="/web/index.html"/>" class="active"><span class="icon fa-home"></span></a></li>--%>
						<%--&lt;%&ndash;<li><a href="gallery.html"><span class="icon fa-camera-retro"></span></a></li>&ndash;%&gt;--%>
						<%--&lt;%&ndash;<li><a href="generic.html"><span class="icon fa-file-text-o"></span></a></li>&ndash;%&gt;--%>
					<%--</ul>--%>
				<%--</nav>--%>

			<!-- Main -->
				<section id="main">

					<!-- Banner -->
						<section id="banner">
							<div class="inner">
								<h1>Hey, I'm SWAB-MAN</h1>
								<p>专业自来水管道清洁，关注您的用水健康</p>
								<!--<ul class="actions">
									<li><a href="#galleries" class="button alt scrolly big">Continue</a></li>
								</ul>-->
							</div>
						</section>

					<!-- Gallery -->
						<section id="galleries">

							<!-- Photo Galleries -->
								<div class="gallery">
									<header class="special">
										<h2>What's New</h2>
									</header>
									<div class="content">
										<div class="media">
											<a href="<c:url value="/templated/swab-man/images/fulls/01.jpg"/>"><img src="<c:url value="/templated/swab-man/images/fulls/01.jpg"/>" alt="" title="This right here is a caption." /></a>
										</div>
										<div class="media">
											<a href="<c:url value="/templated/swab-man/images/fulls/05.jpg"/>"><img src="<c:url value="/templated/swab-man/images/fulls/05.jpg"/>" alt="" title="This right here is a caption." /></a>
										</div>
										<div class="media">
											<a href="<c:url value="/templated/swab-man/images/fulls/09.jpg"/>"><img src="<c:url value="/templated/swab-man/images/fulls/09.jpg"/>" alt="" title="This right here is a caption." /></a>
										</div>
										<div class="media">
											<a href="<c:url value="/templated/swab-man/images/fulls/02.jpg"/>"><img src="<c:url value="/templated/swab-man/images/fulls/02.jpg"/>" alt="" title="This right here is a caption." /></a>
										</div>
										<div class="media">
											<a href="<c:url value="/templated/swab-man/images/fulls/06.jpg"/>"><img src="<c:url value="/templated/swab-man/images/fulls/06.jpg"/>" alt="" title="This right here is a caption." /></a>
										</div>
										<div class="media">
											<a href="<c:url value="/templated/swab-man/images/fulls/10.jpg"/>"><img src="<c:url value="/templated/swab-man/images/fulls/10.jpg"/>" alt="" title="This right here is a caption." /></a>
										</div>
										<div class="media">
											<a href="<c:url value="/templated/swab-man/images/fulls/03.jpg"/>"><img src="<c:url value="/templated/swab-man/images/fulls/03.jpg"/>" alt="" title="This right here is a caption." /></a>
										</div>
										<div class="media">
											<a href="<c:url value="/templated/swab-man/images/fulls/07.jpg"/>"><img src="<c:url value="/templated/swab-man/images/fulls/07.jpg"/>" alt="" title="This right here is a caption." /></a>
										</div>
									</div>
									<%--<footer>--%>
										<%--<a href="gallery.html" class="button big">Full Gallery</a>--%>
									<%--</footer>--%>
								</div>
						</section>

					<!-- Contact -->
						<section id="contact">
							<!-- Social -->
								<div class="social column">
									<h3>关于我们</h3>
									<p>Mus sed interdum nunc dictum rutrum scelerisque erat a parturient condimentum potenti dapibus vestibulum condimentum per tristique porta. Torquent a ut consectetur a vel ullamcorper a commodo a mattis ipsum class quam sed eros vestibulum quisque a eu nulla scelerisque a elementum vestibulum.</p>
									<p>Aliquet dolor ultricies sem rhoncus dolor ullamcorper pharetra dis condimentum ullamcorper rutrum vehicula id nisi vel aptent orci litora hendrerit penatibus erat ad sit. In a semper velit eleifend a viverra adipiscing a phasellus urna praesent parturient integer ultrices montes parturient suscipit posuere quis aenean. Parturient euismod ultricies commodo arcu elementum suspendisse id dictumst at ut vestibulum conubia quisque a himenaeos dictum proin dis purus integer mollis parturient eros scelerisque dis libero parturient magnis.</p>
									<%--<h3>Follow Me</h3>--%>
									<%--<ul class="icons">--%>
										<%--<li><a href="#" class="icon fa-twitter"><span class="label">Twitter</span></a></li>--%>
										<%--<li><a href="#" class="icon fa-facebook"><span class="label">Facebook</span></a></li>--%>
										<%--<li><a href="#" class="icon fa-instagram"><span class="label">Instagram</span></a></li>--%>
									<%--</ul>--%>
								</div>

							<!-- Form -->
								<div class="column">
									<h3>快速预约</h3>
									<form action="#" method="post" id="sendMeetForm">
										<div class="field half first">
											<label for="name">姓名</label>
											<input name="name" id="name" type="text" placeholder="姓名">
										</div>
										<div class="field half">
											<label for="phone">电话</label>
											<input name="phone" id="phone" type="text" placeholder="电话">
										</div>
										<div class="field half first">
											<label for="address">家庭地址</label>
											<input name="address" id="address" type="text" placeholder="家庭地址">
										</div>
										<div class="field half">
											<label for="floorSpace">住房面积</label>
											<select id="floorSpace" name="floorSpace" onchange="floorSpaceChange(this);">
												<c:if test="${not empty floorSpaceList}">
												<c:forEach items="${floorSpaceList}" var="floorSpace">
													<option value="${floorSpace.id}" price="${floorSpace.price}">${floorSpace.spaceSize}</option>
												</c:forEach>
												</c:if>
											</select>
										</div>
										<div class="field half first">
											<label for="price">清洁价格</label>
											<p id="price" style="color: #19B5FE; font-weight: 700;">
												<c:if test="${not empty floorSpaceList}">
													<c:forEach items="${floorSpaceList}" var="floorSpace" begin="0" end="0" step="1">
														￥${floorSpace.price}
													</c:forEach>
												</c:if>
											</p>
										</div>
										<div class="field half">
											<ul class="actions">
												<li><input value="发出预约" id="sendMeet" type="button"></li>
											</ul>
										</div>

									</form>
								</div>

						</section>

					<!-- Footer -->
						<footer id="footer">
							<div class="copyright">
								&copy; Untitled Design: <a href="javascript:void(0);">SWAB-MAN</a>. Images: <a href="javascript:void(0);">SHEN.CHEN</a>.
								<%--&copy; Untitled Design: <a href="https://templated.co/">TEMPLATED</a>. Images: <a href="https://unsplash.com/">Unsplash</a>.--%>
							</div>
						</footer>
				</section>
		</div>

		<!-- Scripts -->
			<script src="<c:url value="/templated/swab-man/assets/js/jquery.min.js"/>"></script>
			<script src="<c:url value="/templated/swab-man/assets/js/jquery.poptrox.min.js"/>"></script>
			<script src="<c:url value="/templated/swab-man/assets/js/jquery.scrolly.min.js"/>"></script>
			<script src="<c:url value="/templated/swab-man/assets/js/skel.min.js"/>"></script>
			<script src="<c:url value="/resources/lib/jquery/plugin/jquery.form.min.js"/>"></script>
			<script src="<c:url value="/resources/hplus/lib/js/plugins/toastr/toastr.min.js"/>"></script>
			<script src="<c:url value="/templated/swab-man/assets/js/util.js"/>"></script>
			<script src="<c:url value="/templated/swab-man/assets/js/main.js"/>"></script>
		<script>
			$(document).ready(function () {

				toastr.options = {
					"closeButton": true,  //是否显示关闭按钮
					"debug": false,   //是否使用debug模式
					"progressBar": true,
					"positionClass": "toast-top-right",  //弹出窗的位置
					"showDuration": "300",   //显示的动画时间
					"hideDuration": "500",  //消失的动画时间
					"timeOut": "5000",      //展现时间
					"extendedTimeOut": "1000",
					"showEasing": "swing",   //显示时的动画缓冲方式
					"hideEasing": "linear",  //消失时的动画缓冲方式
					"showMethod": "fadeIn",  //显示时的动画方式
					"hideMethod": "fadeOut"  //消失时的动画方式
				};

				$("#sendMeet").click(function () {

					var _name = $("#name").val();
					var _phone = $("#phone").val();
					var _address = $("#address").val();

					if($.trim(_name) === '') {
						toastr.warning("检测到姓名为空","消息提示");
						return;
					}
					if($.trim(_phone) === '' || !checkSubmitTel(_phone)) {
						toastr.warning("检测到手机号码为空或格式不对","消息提示");
						return;
					}
					if($.trim(_address) === '') {
						toastr.warning("检测到家庭地址为空","消息提示");
						return;
					}

					var options = {
						url: "<c:url value="/web/receiveMeet.json"/>",
						success: function (data) {
							if (data.status == 0) {
								toastr.success("您已经成功发出预约，稍后我们将与您联系！","消息提示");
							} else {
								toastr.error("发出预约时出错，请联系管理员，我们将及时做出处理！","错误提示");
							}
						}
					};
					$("#sendMeetForm").ajaxSubmit(options);
				});
			});

			//电话手机验证
			function checkSubmitTel(tel){
				var isPhone = /^([0-9]{3,4}-)?[0-9]{7,8}$/;
				var isMob=/^((\+?86)|(\+86))?(13[012356789][0-9]{8}|15[012356789][0-9]{8}|18[02356789][0-9]{8}|147[0-9]{8}|1349[0-9]{7})$/;
				if(isMob.test(tel)||isPhone.test(tel)){
					return true;
				}
				else{
					return false;
				}
			}

			function floorSpaceChange(ele) {

				var _sel_obj = $(ele).find('option:selected');
				var _price = _sel_obj.attr('price');
				if(_price <= 0) {
					$('#price').text('面议');
				}else {
					$('#price').text('￥' + _sel_obj.attr('price'));
				}
			}
		</script>
	</body>
</html>